#include <iostream>
using namespace std;
int calculate(int n, int k);

int main()
{
    int n, k;
    cin >> n >> k;
    cout << calculate(n, k) << endl;
    return 0;
}

int calculate(int n, int k)
{
    k--;
    if (k == 0) //判断是否到达递归边界k=0
        return n % 10;
    else //否则继续递归
        return calculate(n / 10, k);
}
